<?php
defined('IN_MAIN') or exit('Invalid Access!');

function get_week_start_end($in_date, $in_format = 'Y-m-d H:i:s'){
	$day_offset=date("w", strtotime($in_date));
	$from_time=strtotime($in_date)-($day_offset*86400);
	$to_time=$from_time+(6*86400);
	
	$from_time = mktime(0,0,0, date('n', $from_time), date('j', $from_time), date('Y', $from_time));
	$to_time = mktime(23,59,59, date('n', $to_time), date('j', $to_time), date('Y', $to_time));
	
	$result['start'] = date($in_format, $from_time);
	$result['end'] = date($in_format, $to_time);
	
	return $result;
}
?>